<div class="subhead">Login</div>
	<div class="bodywrap" style="background:#f7ecde; min-height:500px">
  	<div class="cont">
  		<div class="formcss">
  			<?php 
	  			$form=$this->beginWidget('CActiveForm', array(
				'id'=>'login-form',
				'enableClientValidation'=>false,
				'clientOptions'=>array(
				'validateOnSubmit'=>true,
				),
			)); 
			?>
			<?php 
				if(Yii::app()->user->hasFlash('successforgotpassword'))
				{
       				echo "<div style='color:green;'>".Yii::app()->user->getFlash('successforgotpassword')."</div>";
    			}
    		?>
    		<?php echo $form->error($model,'username'); ?>	
			<?php echo $form->textField($model,'username',array('value'=>'Email Address','onfocus'=>'setfields("LoginForm_username")')); ?>
			
			<?php echo $form->error($model,'password'); ?>
			<?php echo $form->textField($model,'password',array('value'=>'Password','onfocus'=>'setfields("LoginForm_password")')); ?>

    		<div style="margin-left:30%;padding:1%">
      			<?php echo CHtml::checkBox('autologin',array('checked'=>'checked')); ?> Autologin
    		</div>
     
    		<div class="button">
      			<?php echo CHtml::submitButton('Login',array("data-icon"=>"arrow-r", "rel"=>"external","data-role"=>"button","class"=>"ui-btn-right","data-theme"=>"e" )); ?>
    		</div>
    		<?php $this->endWidget(); ?>
    	</div> 
    </div> 
    <div class="regi">
    <a href="<?php echo ApplicationConfig::getURL('', 'site', 'forgotpassword');?>">Forgot your password?</a> | <a href="<?php echo ApplicationConfig::getURL('', 'site', 'register');?>">Sign up</a></div>
    </div>

<script type="text/javascript">
function setfields(id)
{
	var input = document.getElementById(id);
  	input.value="";
	if(id=="LoginForm_password")
	{
		//input.setAttribute('type','password');     //not workin in IE
	    var input2= input.cloneNode(false);
	    input2.setAttribute('type','password');
	    input2.setAttribute('value','');
	    input2.setAttribute('onfocus','');
	    input.parentNode.replaceChild(input2,input);
	    input2.focus();
	}
}


function trim(s)
{
	return rtrim(ltrim(s));
}

function ltrim(s)
{
	var l=0;
	while(l < s.length && s[l] == ' ')
	{	l++; }
	return s.substring(l, s.length);
}

function rtrim(s)
{
	var r=s.length -1;
	while(r > 0 && s[r] == ' ')
	{	r-=1;	}
	return s.substring(0, r+1);
}

</script>





